package com.ruoyi.service.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.service.project.entity.ProjectLaborEntity;
import com.ruoyi.service.project.model.LaborCount;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 项目岗位招聘情况 Mapper 接口
 * </p>
 *
 * @author Zane
 * @since 2025-10-14
 */
public interface ProjectLaborMapper extends BaseMapper<ProjectLaborEntity> {

  /**
   * 获取项目下岗位招聘情况
   *
   * @param projectIdList 项目ID列表
   * @return 项目下岗位招聘情况
   */
  @Select("<script>"
      + "SELECT project_id AS projectId, COUNT(1) AS laborCount "
      + "FROM t_project_labor "
      + "WHERE 1=1 and status=1 "
      + "and project_id IN "
      + "<foreach item='item' index='index' collection='projectIdList' open='(' separator=',' close=')'>"
      + "#{item}"
      + "</foreach>"
      + "GROUP BY project_id"
      + "</script>"
  )
  List<LaborCount> getProjectLaborCountMap(@Param("projectIdList") List<String> projectIdList);
}
